export default {
  //设置cookie
  setCookiefn(usena, pasw, exday) {
    var exdate = new Date(); //获取时间节点
    exdate.setTime(exdate.getTime() + 24 * 60 * 60 * 1000 * exday); //设置保存时间
    window.document.cookie =
      "userName" + "=" + usena + ";path=/;expires=" + exdate.toGMTString();
    window.document.cookie =
      "password" + "=" + pasw + ";path=/;expires=" + exdate.toGMTString();
  },
  //获取cookie
  getCookiefn() {
    if (document.cookie.length > 0) {
      var arr = document.cookie.split(";");
      console.log(arr);
      for (var i = 0; i < arr.length; i++) {
        var arr2 = arr[i].split("=");
        if (arr2[0] == "userName") {
          this.loginform.accountNumber = arr2[1];
        }
        if (arr2[0] == "password") {
          console.log(arr2[1], "password");
          this.loginform.passWord = arr2[1];
        }
      }
   

    }

  },
  //cookie的清除
  clearcookie() {
    this.setCookiefn("", "", -1);
  },
}
